package user;

import java.sql.ResultSet;

//import sun.security.jca.GetInstance;
import utils.Database;

public class UserDAO {

	private Database db;
	
	
	public UserDAO()
	{	
		db = Database.getInstance();
	}
	
	public User getUser(String username)
	{
		User user = null;
		db.openConn();
		try
		{
			ResultSet rs = db.connect_and_execute("SELECT Username, UserPW FROM SRNUsers WHERE Username='" + username+ "'");
			user = new User();
			while(rs.next())
			{
				user.setUsername(rs.getString("Username"));
				user.setPassword(rs.getString("UserPW"));
			}
			
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
		db.closeConn();
		return user;
	}
	
	
}
